package com.farm.web.init;

import javax.servlet.ServletContext;

import com.farm.core.config.AppConfig;
import com.farm.wcp.util.InitFilePathUtil;
import com.farm.web.init.commons.FreeWcpInfoSenders;
import com.farm.web.task.ServletInitJobInter;

/**
 * 展示项目信息
 * 
 * @author macpl
 *
 */
public class InitStartInfo implements ServletInitJobInter {
	@Override
	public void execute(ServletContext context) {
		InitFilePathUtil.iniPaths();
		System.out.println("physics path:" + context.getRealPath(""));
		System.out.println("wlp version:" + AppConfig.getString("config.sys.version"));
		// 启动线程
		// 实现runnable借口，创建多线程并启动
		new Thread(new Runnable() {
			@Override
			public void run() {
				while (true) {
					try {// 检查时间，定时执行
						Thread.sleep(10000);
						// System.out.println(keyType_TYPE);
						if (FreeWcpInfoSenders.sendAble()) {
							FreeWcpInfoSenders.runSende();
						}
					} catch (Exception e) {
						// e.printStackTrace();
					}
				}
			}
		}) {
		}.start();
	}
}
